package com.wanbangee.marksystem.service.imp;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wanbangee.marksystem.dao.SScoreDao;
import com.wanbangee.marksystem.entities.MExamMarker;
import com.wanbangee.marksystem.entities.SScore;
import com.wanbangee.marksystem.service.RepeatService;

@Service
public class RepeatServiceImp implements RepeatService {

	@Autowired
	private SScoreDao sScoreDao;
	
	@Override
	public List<MExamMarker> selectRepeatList(List<MExamMarker> mList) {
		ArrayList<MExamMarker> result = new ArrayList<>();
		for (MExamMarker mExamMarker : mList) {
			if(mExamMarker.getRepeatExamNum()!=0) {
				result.add(mExamMarker);
			}
		}
		return result;
	}

	@Override
	public List<SScore>  selectRepeatInfo(Integer examId, Integer examSubId, Integer markerId,Integer topicNo, Integer teaId) {
		//查询是阅卷人1还是阅卷人2
		System.out.println("==========================================111111111111111111111111");
		Integer result = sScoreDao.selectSScoreByExamIdExamSubIdMarkerIdTopicNoOnTea12(examId, examSubId, markerId, topicNo, teaId);
		
		System.out.println("========================================="+result);
		//1. 需要获取题号、分值、进度、备注
		List<SScore> sScores = null;
		if(result>0) {
			sScores =  sScoreDao.selectSScoreByExamIdExamSubIdMarkerIdTopicNoOnRepeat(examId, examSubId, markerId, topicNo,1,teaId);
		}else {
			sScores =sScoreDao.selectSScoreByExamIdExamSubIdMarkerIdTopicNoOnRepeat(examId, examSubId, markerId, topicNo,2,teaId);
		}
		return sScores;
	}
	
	
}
